package ru.bragnikita.utils.swing.utils;

import javax.swing.*;
import java.awt.*;

/**
 * @author Nikita.Brazhnikov
 */
public class PanelTest {

    public static void display(final Component comp) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                frame.setLayout(new BorderLayout());
                frame.add(comp, BorderLayout.CENTER);
//                frame.setSize(500, 400);
                frame.pack();
	            GuiUtils.centerFrame(frame);
	            frame.setVisible(true);
            }
        });
    }

    public static JFrame createFrame() {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());
        frame.setSize(500, 400);
        frame.pack();
        return frame;
    }

}
